/*
 * 
 */
package fr.univtln.superplanning.util;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class DateManager {
	/**
	 * static declaration for converting a string into a calendar
	 */
	static public final String DATE_TIME_PATTERN = "dd-MM-yyyy'T'HH:mm";

	public static Calendar StringToCalendar(String stringDate, String pattern)
			throws ParseException {

		SimpleDateFormat format = new SimpleDateFormat(pattern);
		Date date = format.parse(stringDate);
		Calendar calendar = Calendar.getInstance();
		calendar.setTime(date);
		return calendar;
	}

	public static String CalendarToString(Calendar dateTime, String pattern) {
		SimpleDateFormat dateFormat = new SimpleDateFormat(pattern);
		return dateFormat.format(dateTime.getTime());
	}
}
